package com.yifeng.controller;

import com.yifeng.po.Menu;
import com.yifeng.service.IMenuService;
import com.yifeng.util.BlogResult;
import com.yifeng.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Decription :
 * author : yifeng
 * 创建时间 ：2019/1/17 :11:13
 * version : 1.0
 */
@Controller
@RequestMapping("/api/menu")
public class MenuController {

    @Autowired
    private IMenuService menuService;

    @RequestMapping("/list")
    @ResponseBody
    public BlogResult list()
    {
        BlogResult<Menu> menus = menuService.findUserMenuByLoginUserId(UserContext.getUser().getId());

        return menus;
    }

    //递归得到layui菜单格式的json
//    public List getLayuiMenu(List<Menu> list)
//    {
//
//    }

}
